package com.hr.controller;

import com.hr.entity.ConfigMajor;
import com.hr.entity.R;
import com.hr.service.ConfigMajorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.hr.service.ConfigMajorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


import java.util.List;

@RestController
@RequestMapping("/configMajor")
public class ConfigMajorController {
    private ConfigMajorService service;

    /**
     * 查询职位设置
     * @return
     */
    @RequestMapping("/queryList")
    public List<ConfigMajor> queryList(){
        List<ConfigMajor> list = service.queryList();
        return list;
    }

    /**
     * 删除
     * @param makid
     * @return
     */
    @DeleteMapping("/del")
    public R del(Integer makid){
        boolean del = service.del(makid);
        return del ? R.ok("删除成功"):R.fail("删除失败");
    }

    /**
     * 保存/修改
     * @param configMajor
     * @return
     */
    @PostMapping("/save")
    public R save(
            @RequestBody
            ConfigMajor configMajor){
        boolean save = service.save(configMajor);
        return save ? R.ok("保存成功"):R.fail("保存失败");
    }


//    @GetMapping("/queryList")
//    public List<ConfigMajor> queryList(){
//        List<ConfigMajor> list = configMajorService.queryList();
//        return list;
//    }

}
